﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TA.Win.Utils.Design;
using TA.Turbo.Controls;

namespace TA.Turbo.Design
{
	public class PropertiesOptionsProvider : IStringOptionsProvider
	{
		public StringOptions GetOptions(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider)
		{
			StringOptions options = new StringOptions();
			IControlReference cr = context.Instance as IControlReference;
			if (cr != null)
			{
				TControl tc = cr.Control as TControl;
				if (tc != null)
				{
					options.Options = tc.ClientProperties.Keys.ToArray();
					options.CustomValueAllowed = false;
					options.DuplicatesAllowed = false;
				}
			}
			return options;
		}

	}
}
